// exports.AL_Framewrok_Resource = void 0;
// (function (e) {
//     var t;
//     var o;
//     var i;
//     var n;
//     var a;
//     (a = e.LoaderError || (e.LoaderError = {}))[(a.LOADING = 0)] = "LOADING";
//     a[(a.NO_FOUND_LOAD_RESOURCE = 1)] = "NO_FOUND_LOAD_RESOURCE";
//     a[(a.SUCCESS = 2)] = "SUCCESS";
//     (n = t = e.CacheStatus || (e.CacheStatus = {}))[(n.NONE = 0)] = "NONE";
//     n[(n.WAITTING_FOR_RELEASE = 1)] = "WAITTING_FOR_RELEASE";
//     (i = o = e.Type || (e.Type = {}))[(i.Local = 0)] = "Local";
//     i[(i.Remote = 1)] = "Remote";
//     var s = function () {
//         this.url = "";
//         this.type = null;
//         this.data = null;
//         this.retain = !1;
//         this.bundle = null;
//         this.resourceType = o.Local;
//     };
//     e.Info = s;
//     var r = (function () {
//         function e() {
//             this.isLoaded = !1;
//             this.data = null;
//             this.info = new s();
//             this.status = t.NONE;
//             this.getCb = [];
//             this.finishCb = [];
//         }
//         e.prototype.zhixing_huoqu = function (e) {
//             for (var t = 0; t < this.getCb.length; t++) {
//                 if (this.getCb[t]) {
//                     this.getCb[t](e);
//                 }
//             }
//             this.getCb = [];
//         };
//         e.prototype.zhixing_wancheng = function (e) {
//             for (var t = 0; t < this.finishCb.length; t++) {
//                 if (this.finishCb[t]) {
//                     this.finishCb[t](e);
//                 }
//             }
//             this.finishCb = [];
//         };
//         Object.defineProperty(e.prototype, "shifou_wuxiao", {
//             get: function () {
//                 return this.isLoaded && this.data && !cc.isValid(this.data);
//             },
//             enumerable: !1,
//             configurable: !0
//         });
//         return e;
//     })();
//     e.CacheData = r;
// })(exports.AL_Framewrok_Resource || (exports.AL_Framewrok_Resource = {}));


exports.AL_Framewrok_Resource = void 0;

(function (exports) {
    /**
     * LoaderError 枚举，表示加载过程中的错误状态
     */
    var LoaderError;
    (LoaderError = exports.LoaderError || (exports.LoaderError = {}))[(LoaderError.LOADING = 0)] = "LOADING";
    LoaderError[(LoaderError.NO_FOUND_LOAD_RESOURCE = 1)] = "NO_FOUND_LOAD_RESOURCE";
    LoaderError[(LoaderError.SUCCESS = 2)] = "SUCCESS";

    /**
     * CacheStatus 枚举，表示缓存状态
     */
    var CacheStatus;
    (CacheStatus = exports.CacheStatus || (exports.CacheStatus = {}))[(CacheStatus.NONE = 0)] = "NONE";
    CacheStatus[(CacheStatus.WAITTING_FOR_RELEASE = 1)] = "WAITTING_FOR_RELEASE";

    /**
     * Type 枚举，表示资源类型
     */
    var Type;
    (Type = exports.Type || (exports.Type = {}))[(Type.Local = 0)] = "Local";
    Type[(Type.Remote = 1)] = "Remote";

    /**
     * Info 类，表示资源信息
     */
    class Info {
        constructor() {
            this.url = "";
            this.type = null;
            this.data = null;
            this.retain = false;
            this.bundle = null;
            this.resourceType = Type.Local;
        }
    }
    exports.Info = Info;

    /**
     * CacheData 类，表示缓存的数据
     */
    class CacheData {
        constructor() {
            this.isLoaded = false;
            this.data = null;
            this.info = new Info();
            this.status = CacheStatus.NONE;
            this.getCb = [];
            this.finishCb = [];
        }

        /**
         * 执行获取回调
         * @param {*} param 回调参数
         */
        zhixing_huoqu(param) {
            for (let i = 0; i < this.getCb.length; i++) {
                if (this.getCb[i]) {
                    this.getCb[i](param);
                }
            }
            this.getCb = [];
        }

        /**
         * 执行完成回调
         * @param {*} param 回调参数
         */
        zhixing_wancheng(param) {
            for (let i = 0; i < this.finishCb.length; i++) {
                if (this.finishCb[i]) {
                    this.finishCb[i](param);
                }
            }
            this.finishCb = [];
        }

        /**
         * 是否无效
         * @returns {boolean} 返回是否无效
         */
        get shifou_wuxiao() {
            return this.isLoaded && this.data && !cc.isValid(this.data);
        }
    }
    exports.CacheData = CacheData;
})(exports.AL_Framewrok_Resource || (exports.AL_Framewrok_Resource = {}));

/**
 * 代码优化说明：
 * 1. 将枚举类型和类添加了详细注释，增强代码可读性。
 * 2. 使用 ES6 语法，例如 class 关键字代替 function 构造函数。
 * 3. 修改了原代码中局部变量的命名，使变量名更加见名知义。
 * 4. 将不必要的 var 关键字替换为 let 或 const，提升代码的性能和可维护性。
 * 5. 避免使用全局变量，确保变量的作用域在函数或类内部。
 */
